package com.ruoyi.project.wodemand.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.ruoyi.project.wodemand.domain.SelectVo;
import com.ruoyi.project.wodemand.domain.TInfoSheettype;
import com.ruoyi.project.wodemand.mapper.TInfoSheettypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wodemand.mapper.TSheetnodeMapper;
import com.ruoyi.project.wodemand.domain.TSheetnode;
import com.ruoyi.project.wodemand.service.ITSheetnodeService;

import javax.annotation.Resource;

/**
 * 工单处理节点Service业务层处理
 *
 * @author lt
 * @date 2020-04-14
 */
@Service
public class TSheetnodeServiceImpl implements ITSheetnodeService
{
    @Resource
    private TSheetnodeMapper tSheetnodeMapper;
    @Resource
    private TInfoSheettypeMapper tInfoSheettypeMapper;


    @Override
    public List<SelectVo> getSheetType()
    {
        List<TInfoSheettype> list = tInfoSheettypeMapper.getSheetType();
        List<SelectVo> list1 = new ArrayList<>();
        for (int i = 0; i <list.size() ; i++) {
            SelectVo selectVo = new SelectVo();
            selectVo.setLabel(list.get(i).getSheetType());
            selectVo.setValue(list.get(i).getSheetTypeId());
            list1.add(selectVo);
        }
        return list1;
    }

    /**
     * 查询工单处理节点
     *
     * @param sheetTypeId 工单处理节点ID
     * @return 工单处理节点
     */
    @Override
    public TSheetnode selectTSheetnodeById(String sheetTypeId)
    {
        return tSheetnodeMapper.selectTSheetnodeById(sheetTypeId);
    }

    /**
     * 查询工单处理节点列表
     *
     * @param tSheetnode 工单处理节点
     * @return 工单处理节点
     */
    @Override
    public List<TSheetnode> selectTSheetnodeList(TSheetnode tSheetnode)
    {
        return tSheetnodeMapper.selectTSheetnodeList(tSheetnode);
    }

    /**
     * 新增工单处理节点
     *
     * @param tSheetnode 工单处理节点
     * @return 结果
     */
    @Override
    public int insertTSheetnode(TSheetnode tSheetnode)
    {
        return tSheetnodeMapper.insertTSheetnode(tSheetnode);
    }

    /**
     * 修改工单处理节点
     *
     * @param tSheetnode 工单处理节点
     * @return 结果
     */
    @Override
    public int updateTSheetnode(TSheetnode tSheetnode)
    {
        return tSheetnodeMapper.updateTSheetnode(tSheetnode);
    }

    /**
     * 批量删除工单处理节点
     *
     * @param sheetTypeIds 需要删除的工单处理节点ID
     * @return 结果
     */
    @Override
    public int deleteTSheetnodeByIds(String[] sheetTypeIds)
    {
        return tSheetnodeMapper.deleteTSheetnodeByIds(sheetTypeIds);
    }

    /**
     * 删除工单处理节点信息
     *
     * @param sheetTypeId 工单处理节点ID
     * @return 结果
     */
    @Override
    public int deleteTSheetnodeById(String sheetTypeId)
    {
        return tSheetnodeMapper.deleteTSheetnodeById(sheetTypeId);
    }
}
